﻿using MediatR;
using W.Product.API.Appliaction.Command.ProductTypeCommand;
using W.Product.Domain.Product;
using W.Product.Repository.Interface;

namespace W.Product.API.Appliaction.CommandHandler.ProductTypeCommandHandler
{
    public class ProductTypeFindlCommandHandler : IRequestHandler<ProductTypeFindlCommand, ProductType>
    {
        private readonly IProductTypeRepository _repository;
        public ProductTypeFindlCommandHandler(IProductTypeRepository repository)
        {
            _repository = repository;
        }
        /// <summary>
        /// 反填产品类型
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<ProductType> Handle(ProductTypeFindlCommand request, CancellationToken cancellationToken)
        {
            var list=await _repository.FindById(request.ProductTypeId);
            return list;
        }
    }
}
